package com.xs.project.controller;

import com.xs.project.common.Result;
import com.xs.project.pojo.vo.OperateLogReq;
import com.xs.project.pojo.vo.StudentLeaveClassReq;
import com.xs.project.pojo.vo.SysLogReq;
import com.xs.project.pojo.vo.resp.OperateLogResp;
import com.xs.project.pojo.vo.resp.StudentLeaveClassResp;
import com.xs.project.pojo.vo.resp.SysMsgResp;
import com.xs.project.service.IClassManagerService;
import com.xs.project.service.SysMsgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/sysMsg")
@Api(tags = "系统公告")
public class SysMsgController {

    @Resource
    private SysMsgService sysMsgService;

    @ApiOperation(value = "列表-公告", notes = "公告列表")
    @PostMapping(value = "/selectSysMsg")
    public Result<List<SysMsgResp>> selectSysMsg(@RequestBody SysLogReq req) {
        return sysMsgService.selectSysMsg(req);
    }

    @ApiOperation(value = "新增-公告", notes = "公告列表")
    @PostMapping(value = "/insertSysMsg")
    public Result<Boolean> insertSysMsg(@RequestBody SysMsgResp req) {
        return sysMsgService.insertSysMsg(req);
    }

    @ApiOperation(value = "更新-公告", notes = "公告列表")
    @PostMapping(value = "/updateSysMsg")
    public Result<Boolean> updateSysMsg(@RequestBody SysMsgResp req) {
        return sysMsgService.updateSysMsg(req);
    }

    @ApiOperation(value = "删除-公告", notes = "公告列表")
    @PostMapping(value = "/deleteSysMsg")
    public Result<Boolean> deleteSysMsg(@RequestBody SysMsgResp req) {
        return sysMsgService.deleteSysMsg(req.getId());
    }

    @ApiOperation(value = "查询-用户操作日志", notes = "用户操作日志")
    @PostMapping(value = "/selectOperateLog")
    public Result<List<OperateLogResp>> selectOperateLog(@RequestBody OperateLogReq req) {
        return sysMsgService.selectOperateLog(req.getUserId());
    }

}
